import Vue from "vue";
import VueRouter from "vue-router";
import Index from "../views/Shou.vue";

const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter);
const routes = [{
        path: '/search',
        name: 'search',
        component: () =>
            import ( /* webpackChunkName: "search" */ '../views/Search.vue'),
    },
    {
        path: '/login',
        name: 'login',
        component: () =>
            import ( /* webpackChunkName: "login" */ "../views/login.vue"),
    },
    {
        path: '/menu',
        name: 'menu',
        component: () =>
            import ( /* webpackChunkName: "menu" */ "../views/menu.vue")
    },
    {
        path: '/register',
        name: 'register',
        component: () =>
            import ( /* webpackChunkName: "register" */ "../views/register.vue"),
    },
    {
        path: '/forget',
        component: () =>
            import ( /* webpackChunkName: "forget" */ "../views/forget.vue"),
    },
    {
        path: '/search/detail/',
        name: 'detail',
        component: () =>
            import ( /* webpackChunkName: "details" */ "../views/About.vue"),
    },
    {
        path: '/shiyou/info/',
        name: 'shiyou',
        component: () =>
            import ( /* webpackChunkName: "shiyou" */ "../views/sydetails.vue"),
    },
    {
        path: "/shiyou",
        name: 'sy',
        component: () =>
            import ( /* webpackChunkName: "adf" */ "../views/Index.vue"),
    },
    {
        path: "/publish",
        name: 'publish',
        component: () =>
            import ( /* webpackChunkName: "publish" */ "../views/publishHouse.vue"),
    },
    {
        path: "/download",
        component: () =>
            import ( /* webpackChunkName: "download" */ "../views/Download.vue"),
    },
    {
        path: "/",
        name: "Shou",
        component: Index,
        meta: {
            keepAlive: true
        }
    },
    // {
    // path: "/about",
    // name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    // component: () =>
    //     import ( /* webpackChunkName: "about" */ "../views/About.vue"),
    // },
];

const router = new VueRouter({
    routes,
});

export default router;